#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	int a = 0, b = 0, c = 0, d = 0;
	scanf("%d %d", &a, &b);
	if (a > b)
	{
		c = a;
	}
	else {
		c = b;
	}
	for (d = c; d >= 2; d--)
	{
		if (a % d == 0 && b % d == 0)
		{
			printf("%d  ", d);
			break;
		}
	}

	return 0;
}